﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using KegCommunication;
using KegData;

namespace KegPlugin
{
    public class Plugin : IAuthenticatorPlugin
    {
        public int AuthenticateUser()
        {
            // For debugging
            ConsoleEx.AllocConsole();

            int currentUserId = -1;
            // Get the current user

            FaceCapture capture = new FaceCapture();
            string username = capture.Recognize();

            //ConsoleEx.FreeConsole();
            return currentUserId;
        }

        public void Settings()
        {

        }
    }

    public static class ConsoleEx
    {

        /// <summary>
        /// Shows the Console
        /// </summary>
        [DllImport("kernel32.dll")]
        public static extern Boolean AllocConsole();
        /// <summary>
        /// Hides the Console
        /// </summary>
        [DllImport("kernel32.dll")]
        public static extern Boolean FreeConsole();

    }
}
